package com.example.demo.po;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

@DynamicUpdate
@EntityListeners(AuditingEntityListener.class)
@Data
@Entity
@Table(name = "Log")
public class LogPO {

    @Id
    @Column(name = "ID",columnDefinition = "varchar(64) comment 'ID'")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @GeneratedValue(generator = "uuid")
    private String id;

    @ApiModelProperty(value = "操作模块")
    @Column(name = "module",columnDefinition = "varchar(512) comment '操作模块'")
    private String module;

    @ApiModelProperty(value = "执行方法")
    @Column(name = "methods",columnDefinition = "varchar(512) comment '执行方法'")
    private String methods;

    @ApiModelProperty(value = "请求参数")
    @Lob
    @Column(name = "request_params",columnDefinition = "longtext comment '请求参数'")
    private String requestParams;

    @ApiModelProperty(value = "响应参数")
    @Lob
    @Column(name = "response_params",columnDefinition = "longtext comment '响应参数'")
    private String responseParams;

    @ApiModelProperty(value = "IP")
    @Column(name="ip",columnDefinition = "varchar(512) comment 'IP'")
    private String ip;

    @ApiModelProperty(value = "执行结果")
    @Column(name = "flag",columnDefinition = "varchar(3) comment '执行结果'")
    private String flag;

    @Lob
    @Column(name="CLNT_FALSE_INFO",columnDefinition = "longtext comment '客户端错误信息'")
    private  String falseInfo;

    @Column(name="crt_tm",columnDefinition = "datetime comment '创建时间'")
    @CreatedDate
    private Date crtTm;

    @LastModifiedDate
    @Column(name="upd_tm",columnDefinition = "datetime comment '更新时间'")
    private Date upDTm;
}
